{% extends "base.html" %}

{% block content %}
<div class="row justify-content-center min-vh-100 align-items-center">
    <div class="col-md-6 col-lg-4">
        <div class="card shadow-lg border-0" style="border-radius: 20px; background: rgba(255,255,255,0.95); backdrop-filter: blur(10px);">
            <div class="card-body p-5">
                <div class="text-center mb-4">
                    <div class="mb-3" style="background: var(--primary-gradient); width: 80px; height: 80px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto;">
                        <i class="bi bi-activity" style="font-size: 2.5rem; color: white;"></i>
                    </div>
                    <h3 class="mt-3 mb-2" style="background: var(--primary-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-weight: bold;">网站监控系统</h3>
                    <p class="text-muted">请登录您的账号</p>
                </div>
                
                <form method="POST">
                    {{ form.hidden_tag() }}
                    
                    {% if form.errors %}
                    <div class="alert alert-danger">
                        {% for field, errors in form.errors.items() %}
                            {% for error in errors %}
                                <div>{{ error }}</div>
                            {% endfor %}
                        {% endfor %}
                    </div>
                    {% endif %}
                    
                    <div class="mb-3">
                        {{ form.username.label(class="form-label fw-bold") }}
                        {{ form.username(class="form-control form-control-lg", placeholder="输入用户名") }}
                    </div>
                    <div class="mb-4">
                        {{ form.password.label(class="form-label fw-bold") }}
                        {{ form.password(class="form-control form-control-lg", placeholder="输入密码") }}
                    </div>
                    <button type="submit" class="btn btn-primary btn-lg w-100 mb-3" style="border-radius: 25px; padding: 12px;">
                        <i class="bi bi-box-arrow-in-right me-2"></i>登录
                    </button>
                </form>
                
                <div class="text-center">
                    {% if admin_password_exists %}
                    <div class="alert alert-warning border-0" style="background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%); border-radius: 15px;">
                        <i class="bi bi-exclamation-triangle me-2"></i>
                        <small>默认管理员账号: <strong>admin</strong><br>密码请查看 <strong>admin_password.txt</strong> 文件</small>
                    </div>
                    {% else %}
                    <div class="alert alert-info border-0" style="background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%); border-radius: 15px;">
                        <i class="bi bi-info-circle me-2"></i>
                        <small>请使用管理员账号登录</small>
                    </div>
                    {% endif %}
                </div>
            </div>
        </div>
    </div>
</div>

<style>
body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}
</style>
{% endblock %}